<template>
	<view>
		<view class="header_index_home_view" :style="{marginTop: systemBarHeight + 'px'}">
			<view class="" style="font-size: 34rpx;color: #333;font-weight: 500;">
				{{tally['title']}}
			</view>
			<image src="../static/index_xiala_select.png" style="width: 40rpx;height: 40rpx;"/>
		</view>
		<view class="" style="height: 24rpx;">
			
		</view>
		<view class="shouzhi_now_card">
			
		</view>
		<view class="" style="height: 40rpx;">
			
		</view>
		<view class="shouzhi_anniu_card">
			<view class="shou_zhi_card_item" @click="toJiYiBi">
				<image src="../static/index_shouru_icon.png" style="width: 100rpx;height: 100rpx;"/>
				<view class="shou_zhi_card_item_font">
					记收入
				</view>
			</view>
			<view class="shou_zhi_card_item" @click="toJiYiBi">
				<image src="../static/zhichu_icon.png" style="width: 100rpx;height: 100rpx;"/>
				<view class="shou_zhi_card_item_font">
					记支出
				</view>
			</view>
			<view class="shou_zhi_card_item" @click="toJiYiBi">
				<image src="../static/zhuanzhang_icon.png" style="width: 100rpx;height: 100rpx;"/>
				<view class="shou_zhi_card_item_font">
					记转账
				</view>
			</view>
		</view>
		<view class="" style="height: 32rpx;">
			
		</view>
		
		<view class="index_card_account_view">
			<view class="index_card_account_view_item" style="background-image: url('../static/index_yingshou.png')">
				<view class="index_card_account_view_item_font1">
					应收/应付
				</view>
				<view class="index_card_account_view_item_font2">
					资金往来 收付有道
				</view>
			</view>
			
			<view class="index_card_account_view_item" style="background-image: url('../static/index_yingfu.png')">
				<view class="index_card_account_view_item_font1">
					预收/预付b 
				</view>
				<view class="index_card_account_view_item_font2">
					财务提前 业务无忧
				</view>
			</view>
		</view>
		
		<view class="" style="height: 44rpx;">
			
		</view>
		
		<view class="index_account_bg">
			<view class="">
				账户管理
			</view>
			<view class="">
				{{zifuCountDebt['asset_net']}} <font color="#333" style="margin-left: 20rpx;">></font>
			</view>
		</view>
		
		<view class=""c style="height: 32rpx;">
			
		</view>
		<view class="index_account_bg_btn">
			<view class="index_account_bg_btn_item">
				账目明细	
			</view>
			<view class="" style="width: 1rpx;height: 48rpx;background-color: #CCCCCC;">
				
			</view>
			<view class="index_account_bg_btn_item">
				账目审核	
			</view>
		</view>
		<view class="" style="height: 32rpx;">
			
		</view>
		
		<view class="gongneng_icons_view">
			<view class="gongneng_icons_item">
				<image src="../static/fenlei.png" style="width: 56rpx;height: 56rpx;"/>
				<view class="gongneng_icons_item_font">
					分类管理
				</view>
			</view>
			<view class="gongneng_icons_item" @click="toKeHu">
				<image src="../static/kehu.png" style="width: 56rpx;height: 56rpx;"/>
				<view class="gongneng_icons_item_font">
					客户管理
				</view>
			</view>
			<view class="gongneng_icons_item">
				<image src="../static/xiangmu.png" style="width: 56rpx;height: 56rpx;"/>
				<view class="gongneng_icons_item_font">
					项目管理
				</view>
			</view>
			<view class="gongneng_icons_item">
				<image src="../static/yuangong.png" style="width: 56rpx;height: 56rpx;"/>
				<view class="gongneng_icons_item_font">
					员工管理
				</view>
			</view>
			<view class="gongneng_icons_item">
				<image src="../static/zhangben.png" style="width: 56rpx;height: 56rpx;"/>
				<view class="gongneng_icons_item_font">
					账本设置
				</view>
			</view>
		</view>
		<view class="" style="height: 30rpx;">
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				systemBarHeight: 0,
				zifuCountDebt:{
					'asset': '0.00',
					'asset_net': '0.00',
					'debt': '0.00',
				}
			}
		},
		onLoad() {
			this.getSysteminfo()
			this.get_tallys()
		},
		computed:{
			tally(){
				return this.$store.state.tally;
			}
		},
		methods: {
			async get_tallys(){
				this.$commonUtils.showLoading()
				let resultData = await this.$api.get_user_info();
				console.log( resultData )
				let resultTally = await this.$api.common.get_tallys();
				console.log( resultTally )
				//设置账本列表
				this.$store.commit('setTallys',resultTally['data'])
				console.log(this.$store.state.tallys)
				let that = this
				this.$store.state.tallys.map(function(value) {
				  if (value['is_default'] == 1) {
					that.$store.commit('setTally',value)
				  }
				})
				if (that.$store.state.tally['id'] == '') {
					that.$store.commit('setTally',this.$store.state.tallys[0])
				}
				await this.refreshData()
				this.$commonUtils.hideLoading()
				//刷新会员天数
				
			},
			refreshData(){
				this.$commonUtils.showLoading()
				this.get_account()
				this.$commonUtils.hideLoading()
			},
			
			async get_account(){
				var resultData = await this.$api.common.get_summary({
					data:{
						tally_id:this.tally['id']
					}
				});
				console.log(resultData)
				this.zifuCountDebt = resultData['data']
			},
			toKeHu(){
				this.$Router.navigateTo({
					route:this.$path.content.kehu
				})
			},
			toJiYiBi(){
				this.$Router.navigateTo({
					route:this.$path.content.jiyibi
				})
			},
			getSysteminfo() {
				uni.getSystemInfo({
					success: res => {
						this.systemBarHeight = res.statusBarHeight;
					}
				});
			}
		}
	}
</script>

<style scoped>
	.gongneng_icons_item_font{
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 22rpx;
		color: #333333;
		font-style: normal;
		text-transform: none;
		margin-top: 16rpx;
	}
	.gongneng_icons_item{
		text-align: center;
		flex: 1;
	}
	.gongneng_icons_view{
		display: flex;
		align-items: center;
		width: 686rpx;
		height: 88rpx;
		margin: 0 auto;
		background-color: #FFF;
		box-shadow: 0px 8px 16rpx 0px rgba(19,76,170,0.08);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		padding-top: 30rpx;
		padding-bottom: 30rpx;
	}
	.index_account_bg_btn_item{
		flex: 1;
		text-align: center;
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 24rpx;
		color: #4185F4;
		line-height: 28rpx;
		font-style: normal;
		text-transform: none;
	}
	.index_account_bg_btn{
		display: flex;
		align-items: center;
		width: 686rpx;
		height: 88rpx;
		margin: 0 auto;
		background-color: #FFF;
		box-shadow: 0px 8px 16rpx 0px rgba(19,76,170,0.08);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}
	.index_account_bg view:first{
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #666666;
		line-height: 33rpx;
		text-align: left;
		font-style: normal;
		text-transform: none;
	}
	.index_account_bg view:nth-child(2){
		font-family: DIN, DIN;
		font-weight: 500;
		font-size: 44rpx;
		color: #4185F4;
		line-height: 52rpx;
		text-align: left;
		font-style: normal;
		text-transform: none;
	}
	.index_account_bg{
		width: 662rpx;
		height: 156rpx;
		padding-top: 10rpx;
		padding-bottom: 10rpx;
		padding-left: 24rpx;
		background-image: url("https://static.gongsizhang.com/2024-05-20-664b70a98ff07.png");
		background-size: 100% 100%;
		background-repeat: no-repeat;
		box-shadow: 0px 8rpx 16rpx 0px rgba(19,76,170,0.08);
		margin: 0 auto;
		display: flex;
		flex-direction: column;
		justify-content: space-around;
	}
	.index_card_account_view_item_font1{
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #FFFFFF;
		line-height: 33rpx;
		text-align: left;
		font-style: normal;
		text-transform: none;
	}
	.index_card_account_view_item_font2{
		margin-top: 8rpx;
		font-family: PingFang SC, PingFang SC;
		font-weight: 400;
		font-size: 22rpx;
		color: rgba(255, 255, 255, 0.6);
		line-height: 26rpx;
		text-align: left;
		font-style: normal;
		text-transform: none;
	}
	.index_card_account_view{
		width: 686rpx;
		margin: 0 auto;
		display: flex;
		justify-content: space-between;
	}
	.index_card_account_view_item{
		width: 306rpx;
		height: 118rpx;
		background-size: 100% 100%;
		background-repeat: no-repeat;
		padding-left: 24rpx;
		padding-top: 40rpx;
	}
	
	
	.header_index_home_view {
		height: 88rpx;
		display: flex;
		align-items: center;
		width: 686rpx;
		background-color: #FFF;
		padding-left: 32rpx;
		padding-right: 32rpx;
	}
	.shouzhi_now_card{
		width: 686rpx;
		height: 304rpx;
		background-image: url("https://static.gongsizhang.com/2024-05-20-664b70c4d58aa.png");
		background-size: 100% 100%;
		background-repeat: no-repeat;
		margin: 0 auto;
	}
	.shouzhi_anniu_card{
		width: 686rpx;
		height: 230rpx;
		margin: 0 auto;
		display: flex;
		align-items: center;
		background: linear-gradient( 180deg, rgba(255,255,255,0.6) 0%, #FFFFFF 29%, #FFFFFF 100%);
		box-shadow: 0px 8rpx 16rpx 0px rgba(31,98,207,0.08);
		border-radius: 40rpx 40rpx 40rpx 40rpx;
		border: 3rpx solid;
		border-image: radial-gradient(circle, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0.2)) 3 3;
	}
	.shou_zhi_card_item{
		flex: 1;
		text-align: center;
	}
	.shou_zhi_card_item_font{
		font-family: PingFang SC, PingFang SC;
		font-weight: 500;
		font-size: 28rpx;
		color: #333333;
		line-height: 33rpx;
		text-align: center;
		font-style: normal;
		text-transform: none;
	}
</style>